<template>
    <a-table :data-source="students">
       
        <a-table-column key="name" title="姓名" data-index="name" />
        <a-table-column key="gender" title="性别" data-index="gender" />
        <a-table-column key="age" title="年龄" data-index="age" />
     
        <a-table-column key="action" title="操作">
            <template #default="{ record }">
                <span>
                    <a-button type="primary" @click="handleEdit(record._id)" >修改</a-button>
                    <a-divider type="vertical" />
                    <a-button danger  >删除</a-button>
                </span>
            </template>
        </a-table-column>
    </a-table>
</template>

<script setup>
import useStudentStore from '../../store/student';
import {storeToRefs} from 'pinia'
const props = defineProps(["students"]);
const studentStore = useStudentStore();
// const {updateVisible,fetchStudent} = storeToRefs(studentStore);
function handleEdit(id){
    studentStore.updateVisible = true;
    studentStore.fetchStudent(id);
}
</script>

<style>
</style>